<template>
	<view class="box">
		<uni-nav-bar title="招聘列表" shadow left-icon="left" rightIcon="plusempty" @clickLeft="gomy()" @clickRight="goadd()"/>
		<view class="box-main">
			<view class="main-card" v-for="(item,index) in msglist" :key="item.id">
				<view class="card-top">
					<view class="top-title">
						<text>{{item.title}}</text>
					</view>
					<view class="top-xinzi">
						<text>{{item.xinzi}}</text> ￥/天
					</view>
				</view>
				<view class="card-bottom">
					<view class="bottom-left">
						<view class="bottom-img">
							<image src="../../../../static/img/1.svg" mode=""></image>
						</view>
						<view class="bottom-name">
							<text>{{item.qyname}}</text>
						</view>
					</view>
					<view class="bottom-number">
						<text>招聘{{item.number}}人</text>
					</view>
				</view>
				<view class="card-bt">
					<view class="bt1" @tap="dlemsg(item.id)">
						<text>删除</text>
					</view>
					<view class="bt2" @tap="goupmsg(item.id,item.title,item.xinzi,item.number)">
						<text>详情</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import axios from "axios"
	export default {
		data() {
			return {
				msglist:[],
			}
		},
		mounted() {
			const userid = uni.getStorageSync('userlist')[0].id
			axios.get('/api/qiyezhaopingmsg?userid='+userid)
			.then(res =>{
				console.log(res.data);
				this.msglist = res.data
			})
		},
		methods: {
			gomy(){
				uni.switchTab({
					url:'/pages/my/my'
				})
			},
			goadd(){
				uni.navigateTo({
					url:'/pages/my/qiye/addmage'
				})
			},
			goupmsg(id,title,xinzi,number){
				uni.navigateTo({
					url:'/pages/my/qiye/updatamsg?id='+id
					+'&title='+title+'&xinzi='+xinzi+'&number='+number
				})
			},
			dlemsg(id){
				axios.delete('/api/dledetails?id='+id).then(res=>{
					this.$router.go(0)
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.box {
		width: 100%;
		height: 100%;
		.box-main {
			width: 100%;
			height: 100%;
			padding: 5% 5%;
			background-color: #ececec;
			margin-bottom: 100rpx;
			.main-card{
				width: 100%;
				height: 320rpx;
				background-color: #ffffff;
				padding: 20rpx;
				border-radius: 10px;
				margin-top: 10rpx;
				.card-top{
					display: flex;
					justify-content: space-between;
					flex: 1;
					
					padding: 10rpx 0;
					font-size: 40rpx;
					color: #99CCCC;
				}
				.card-bottom{
					display: flex;
					flex: 2;
					align-items: center;
					justify-content: space-between;
					padding: 10rpx 0;
					.bottom-left{
						
						display: flex;
						align-items: center;
						.bottom-img{
							width: 100rpx;
							height: 100rpx;
							image{
								width: 100%;
								height: 100%;
							}
						}
					}
				}
				.card-bt{
					display: flex;
					justify-content: flex-end;
					padding-top: 20rpx;
					border-top: 1px solid #cccccc;
					.bt1,.bt2{
						border: 1px solid black;
						margin: 0 10px;
						padding: 10rpx 30rpx;
						border-radius: 20px;
						color: #000000;
					}
					.bt1{
						border: 1px solid #CC3333;
						color: #CC3333;
					}
				}
			}
		}
	}
</style>
